import request from "../utils/request";

//登录
export async function login (data) {
  return await request({
    url: '/user/login',
    method: 'post',
    data:data
  })
}

//注册
export async function register (data) {
  return await request({
    url: '/user/register',
    method: 'post',
    data:data
  })
}

//忘记密码
export async function forget (data) {
  return await request({
    url: '/user/forget',
    method: 'post',
    data:data
  })
}

//获取验证码
export async function getCode (data) {
  return await request({
    url: '/user/code',
    method: 'post',
    data:data
  })
}

//修改信息
export async function update (data,param) {
  return await request({
    url: '/user',
    method: 'put',
    data:data,
    headers: {
      'Content-Type': 'application/json',
      'token': param.token 
    }
  })
}

//查询我的信息
export async function getMyInfo () {
  return await request({
    url: '/user/profile',
    method: 'get'
  })
}